home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / wordproc / njsdk30.arj / NJSDK.TXT < prev    next >
Text File  |  1994-02-15  |  35KB  |  867 lines

  1.  
  2.          NN      NN     JJJJJJ   SSSSSSSS DDDDDDDD   KK      KK (TM)
  3.          NN      NN       JJ   SS         DD      DD KK    KK
  4.          NNNN    NN       JJ   SS         DD      DD KK  KK
  5.          NN  NN  NN       JJ     SSSSSS   DD      DD KKKK
  6.          NN    NNNN       JJ           SS DD      DD KK  KK
  7.          NN      NN JJ    JJ           SS DD      DD KK    KK
  8.          NN      NN   JJJJ     SSSSSSSS   DDDDDDDD   KK      KK
  9.  
  10.                               NJSDK (tm)
  11.  
  12.              NJStar Chinese Software Development Kits v3.0
  13.         Copyright (c) Hongbo Ni 1992-1994. All Rights Reserved
  14.  
  15.  
  16.         Hongbo Data Systems
  17.         P.O. Box 40                    Telephone:  +61-2-869-0821
  18.         Epping NSW 2121                Fax:        +61-2-869-0823
  19.         AUSTRALIA                      Compuserve: 100032,2724
  20. ___________________________________________________________________________
  21.  
  22. 1. Introduction
  23. ============================================================================
  24.  
  25. NJSDK is a C Library based on NJSTAR Version 3.0. It contains  all  the
  26. functions for handling Chinese input, display and printing. With NJSDK, user
  27. can develop any Chinese applications without knowing how Chinese  characters
  28. are inputed, displayed or printed. It is  as  easy  as  writing  an  English
  29. program.
  30.  
  31. NJSDK provides a Chinese interface for any C program. It reserves the bottom
  32. line for Chinese input, and all other 24 lines (on VGA, 18  on  EGA,  29  on
  33. SVGA) are working area for the application. NJSDK starts by loading  Chinese
  34. font and dictionaries into memory, which require 200KB. If  user  select  to
  35. leave font on disk, then NJSDK only requires 80KB  to  operate.  When  NJSDK
  36. exits, all used memory are released, and screen is back to text mode.
  37.  
  38. NJSDK supports all the input methods in NJSTAR v3.0,  user  defined  methods
  39. also supported in the same way as in NJSTAR. ALT+Function Keys are  reserved
  40. by NJSDK for switching between the Chinese input methods (as listed in  next
  41. section), and other Chinese related function.
  42.  
  43. Mouse operations are directly supported by NJSDK,  application  program  can
  44. get mouse position by calling the NJSDK mouse functions.
  45.  
  46. Screen Saver and AutoSave  facilities  have  been  built  in  NJSDK.  Active
  47. interval can be set by a configuration program NJSDKCFG.EXE.
  48.  
  49. 2. License Information
  50. ============================================================================
  51.  
  52. With the full payment for NJSDK, the developer are  granted  a  distribution
  53. license which permits the distribution of all NJSTAR  dictionaries,  drivers
  54. and fonts (total 30  files)  with  their  application  without  any  further
  55. royalty payment. Distribution of any Executable file (*.EXE)  of  NJSTAR  is
  56. strictly prohibited. Each licensed copy has an unique  serial  number,  this
  57. protects any illegal use of NJSDK by other un-licensed users. Licensed  user
  58. are entitled a free upgrade  to  next  version  of  NJSDK  when  it  becomes
  59. available.  Please contact the author for current price.  Please contact the
  60. author if you or your company have any special requirements or cooperations.
  61.  
  62.                               LIMITED WARRANTY
  63.  
  64. A)   The Author  of NJSDK warrants  that all disks provided  are free from
  65.      defects in material and workmanship, assuming normal use, for a period
  66.      of 30 days from the date of purchase.
  67.  
  68. B)   The  Author  of NJSDK  warrants  that  the  program will  perform  in
  69.      substantial  compliance with  the documentation  supplied  within this
  70.      document.    If a  significant  defect in  the  product is  found, the
  71.      Purchaser may return the product for a  refund.  In no event will such
  72.      a refund exceed the purchase price of the product.
  73.  
  74. C)   Use of this product for any period of time constitutes your acceptance
  75.      of this agreement and subjects you to its contents.
  76.  
  77. D)   EXCEPT  AS  PROVIDED  ABOVE,  THE   AUTHOR   OF  NJSDK  DISCLAIMS  ALL
  78.      WARRANTIES, EITHER EXPRESS OR  IMPLIED, INCLUDING, BUT NOT  LIMITED TO
  79.      IMPLIED WARRANTIES  OF MERCHANTABILITY  AND FITNESS  FOR A  PARTICULAR
  80.      PURPOSE,  WITH RESPECT  TO  THE  PRODUCT.   SHOULD  THE PROGRAM  PROVE
  81.      DEFECTIVE, THE PURCHASER ASSUMES THE RISK OF PAYING THE ENTIRE COST OF
  82.      ALL NECESSARY SERVICING,  REPAIR, OR CORRECTION AND  ANY INCIDENTAL OR
  83.      CONSEQUENTIAL DAMAGES.  IN NO  EVENT WILL THE  AUTHOR   OF   NJSDK BE
  84.      LIABLE  FOR  ANY  DAMAGES  WHATSOEVER  (INCLUDING  WITHOUT  LIMITATION
  85.      DAMAGES FOR LOSS OF  BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS  OF
  86.      BUSINESS INFORMATION  AND  THE LIKE)  ARISING OUT  OF THE  USE OR  THE
  87.      INABILITY TO USE THIS  PRODUCT EVEN IF THE AUTHOR HAS  BEEN ADVISED OF
  88.      THE POSSIBILITY OF SUCH DAMAGES.
  89.  
  90.  
  91. 3. List of files in NJSDK package
  92. ============================================================================
  93.  
  94.         NJSDK.LIB       The NJSDK C subroutine library (MSC 7.0 Large model)
  95.         NJSDK.H         The header file for NJSDK
  96.         KEYS.H          The header file for key and mouse button definitions
  97.         ******.C        Example programs
  98.         CC.BAT          Batch file used to compile program, eg.  CC hello
  99.         NJSDK.DOC       NJSDK user manual in MS-Word 2.0 for Win. Format
  100.         NJSDK.TXT       Text version of NJSDK.DOC
  101.         NJSDK.INI       Tell NJSDK where are the NJSTAR dictionaries & font
  102.         NJSDK.CFG       NJSDK configuration file
  103.         NJSDKCFG.EXE    The application configuration program
  104.         SUPER.VGA       The super VGA definition file (required by NJSDKCFG)
  105.  
  106. Following files from NJSTAR are needed for program based on  NJSDK  to  run.
  107. Those files can be distributed with user's .EXE file  only  after  a  proper
  108. distribution license has been purchased.
  109.  
  110.         CCLIB.16        16x16 Simplified Chinese bitmap
  111.         CCLIB.24        24x24 Simplified Chinese bitmap (With Reg. ver)
  112.         CCLIBF.16       16x16 un-Simplified Chinese bitmap
  113.         CCLIBF.24       24x24 un-Simplified Chinese bitmap (With Reg. ver)
  114.         ASCII.16        16x8 Ascii bitmap
  115.         ASCII.24        24x12 Ascii bitmap
  116.  
  117.         NANJIPY.DIC      NJSTAR PinYin dictionary
  118.         NANJILX.DIC     NJSTAR Lianxiang dictionary
  119.         NJINPUT*.DIC    External character input methods dictionary
  120.         NJCIZU*.DIC     External word input methods dictionary
  121.         TOLERATE.DIC    PinYin Tolerance lists (text file)
  122.         ********.DRV    Printer drivers
  123.  
  124. If NJSTAR is installed on C:\NJSTAR, a file NJSDK.INI can be created in
  125. the same directory as user's application. It should contains two lines:
  126.  
  127. NJDIC=C:\NJSTAR
  128. NJZK=C:\NJSTAR
  129.  
  130. NJSDK will try to locate the font and dictionaries in the same directory as
  131. users EXE file. If not found, NJSDK will try those as defined in NJSDK.INI.
  132. user can also set two DOS environment variables in AUTOEXEC.BAT to specify
  133. the location of fonts and dictionaries (override NJSDK.INI).
  134.  
  135. SET NJZK=C:\NJSTAR
  136. SET NJDIC=C:\NJSTAR
  137.  
  138. In this way, only one set of font and dictionaries are needed in one
  139. computer, all the NJSDK applications and NJSTAR can access the same font
  140. and dictionaries.
  141.  
  142.  
  143. 4. Function Keys Reserved by NJSDK
  144. ============================================================================
  145.  
  146.         Alt+F1  -  NJSDK Help           Alt+F9   -  Pure Chinese Input
  147.         Alt+F2  -  Other Input Methods  Alt+F10  -  FanTiZi or JianTiZi
  148.         Alt+F3  -  QuWeiMa Input        Alt+F11  -  Adding Character/Word
  149.         Alt+F4  -  GuoBiao Input        Alt+F12  -  Remove Character/Word
  150.         Alt+F5  -  PinYin Input
  151.         Alt+F6  -  ASCII Input          Alt+'X'  -  LianXiang
  152.         Alt+F7  -  ZhuYin Input         Alt+'Z'  -  Get PinYin/ Input Code
  153.         Alt+F8  -  Options              ESC      -  Cancel Current Input
  154.  
  155.  
  156. 5. List of NJSDK Functions
  157. ============================================================================
  158.  
  159. Function Name   Descriptions
  160. --------------  ------------------------------------------------------------
  161. NJ_AutoSave     Tell NJSDK which is your AutoSave function
  162. NJ_box          Draw a rectangle box in given color
  163. NJ_button       Select from a list of buttons
  164. NJ_clscolum     clear a column of text
  165. NJ_clsrows      clear rows of text
  166. NJ_cursorOnOff  turn on / off the blinking input cursor
  167. NJ_dialog       A dialog entry program
  168. NJ_end          end of NJSDK session (unload font and dictionaries)
  169. NJ_entry        entry input routine
  170. NJ_fillwin      fill a window with color
  171. NJ_fontsize     Change the size of Chinese characters.
  172. NJ_formfeed     Form Feed
  173. NJ_getkey       get the key pressed by user
  174. NJ_getmouse     get mouse position
  175. NJ_gets         get a string with Chinese characters
  176. NJ_gets0        get a string without Chinese characters
  177. NJ_init         Initialise NJSDK library (setup Graphics mode, load Chinese)
  178. NJ_line         Draw a horizontal or vertical line
  179. NJ_linefeed     Line feed
  180. NJ_menu         menu selection routine
  181. NJ_mousecursor  turn on /off the mouse cursor
  182. NJ_prt_end      end of the printing
  183. NJ_prt_init     Initialising printer
  184. NJ_prts         print a string to printer
  185. NJ_putc         put a English (ascii 1-255) to screen
  186. NJ_puts         put a string on screen (with or without Chinese Characters)
  187. NJ_setcursor    set cursor position
  188. NJ_setinput     set Chinese input Method
  189. NJ_setmargin    Set Margins and line spacing
  190. NJ_window       draw a window with color
  191.  
  192.  
  193.  
  194.  
  195. 6. Detailed Description of NJSDK functions
  196. ============================================================================
  197.  
  198. *       Initialization
  199. __________________________________________________________________________
  200.  
  201. NJ_init         Initialise NJSDK library, such as setup graphics mode, load
  202.                 Chinese font and dictionaries. This function must be called
  203.                 before any NJSDK function is used.
  204.  
  205. Calling Syntax: NJ_init(char *homedir)
  206. Input:          homedir - a char pointer points to the dir where application
  207.                 is started this is used for NJSDK to locate font and
  208.                 dictionaries
  209. Return:         0  - Initialisation OK
  210.                 -1 - Initialisation failed
  211. See also:       NJ_end
  212. Example:        
  213.         main(int argc, char **argv)
  214.         {
  215.                 NJ_init(argv[0]);
  216.                 ....
  217.                 ....
  218.                 NJ_end();
  219.         }
  220. __________________________________________________________________________
  221.  
  222. NJ_end          Exit NJSDK library, font and dictionaries are unloaded and
  223.                 screen are set back to text mode.
  224.  
  225. Calling Syntax: NJ_end()
  226. Input:          (none)
  227. Output:         (none)
  228. Return:         (none)
  229. See also:       NJ_init
  230. Example:        see NJ_init
  231. ___________________________________________________________________________
  232.  
  233. NJ_AutoSave     Tell NJSDK which is your AutoSave function
  234.  
  235. Calling Syntax: int NJ_AutoSave(int(*asfun)())
  236. Input:  int *asfun() -- a function pointer points to the user's
  237.         SaveSave Funcion.
  238. Output: (none)
  239. Example:
  240.         int myautosave()
  241.         {
  242.             /* Close the data base, or    */
  243.             /* do anything you like to do */
  244.         }
  245.  
  246.         main(int argc, char **argv)
  247.         {
  248.                 NJ_init(argv[0]);
  249.                 NJ_AutoSave(myautosave);
  250.                 ....
  251.                 ....
  252.                 NJ_end();
  253.         }
  254.  
  255. NOTE: User should call this function if Autosave features are needed, and do
  256.       any thing you want to do in it. such as backup data base. NJSDK will
  257.       call this  function in a preset interval or when any emergency happen.
  258.       a default function is provided by NJSDK, which does nothing.
  259. ____________________________________________________________________________
  260.  
  261. NJ_getvideo     Get Video screen parameters
  262.  
  263. Calling Syntax: int NJ_getvideo(struct NJVIDEO *njv)
  264. Input:          struct NJVIDEO *njv -- pointer to NJVIDEO structure
  265.  
  266.                 struct NJVIDEO {
  267.                   int Videomode;    /* Current Video Mode (see NJSDK.H)    */
  268.                   int Nrows;        /* number of rows EGA=18 VGA=24 SVGA=29*/
  269.                   int BytesPerLine; /* bytes per line EGA/VGA=80 SVGA=100  */
  270.                   int PixelsPerRow; /* Pixels per row EGA=18 VGA/SVGA=19   */
  271.                   int Mono;         /* Is a monochrome mornitor            */
  272.                 };
  273.  
  274. Output:         struct NJVIDEO *njv
  275.  
  276. See also:       NJ_init()
  277. Example:
  278.         #include "njsdk.h"
  279.         struct NJVIDEO njv;
  280.         main(int argc, char **argv)
  281.         {
  282.                 NJ_init(argv[0]);
  283.                 NJ_getvideo(&njv)
  284.  
  285.                 ....
  286.                 ....
  287.                 NJ_end();
  288.         }
  289. __________________________________________________________________________
  290.  
  291.  
  292. *       Keyboard and Mouse Input
  293. ___________________________________________________________________________
  294.  
  295. NJ_getkey       wait for user to press a key, and return the key values as
  296.                 defined in header file KEYS.H
  297.  
  298. Calling Syntax: NJ_getkey()
  299. Input:  (none)
  300. Output: (none)
  301. Return:         the key pressed (see KEYS.H for predefined value)
  302. See also:       NJ_getmouse()
  303. Example:        
  304.         #include "keys.h"
  305.         ....
  306.         k=NJ_getkey();
  307.         if(k==ESC) exit(0);
  308.         ....
  309. ___________________________________________________________________________
  310.  
  311. NJ_getmouse     report the current mouse position (row, column in pixels).
  312.  
  313. Calling Syntax: NJ_getmouse(int *row, int *col) 
  314. Input:          (none)
  315. Output:         int *row, *col -- the current mouse cursor position
  316. Return:         the key value if any key is pressed
  317. See also:       NJ_getkey()
  318. Example:        
  319.         int row, col;
  320.         NJ_getmouse(&row, &col);
  321.         sprintf(str,"mouse position: %d %d", row,col);
  322.         NJ_puts(str, 10,10,15);
  323. ___________________________________________________________________________
  324.  
  325. NJ_mousecursor  Turn on / off mouse cursor during screen outputs
  326.                  
  327. Calling Syntax: NJ_mousecursor(int on)
  328. Input:          on = 1 -- turn ON the mouse cursor
  329.                 on = 0 -- turn OFF the mouse cursor
  330. Output:         (none)
  331. Return:         (none)
  332. See also:       NJ_getmouse()
  333. Example:        
  334.         NJ_mousecursor(0);
  335.         NJ_puts(str, ...);
  336.         NJ_mousecursor(1);
  337.         ....
  338. ___________________________________________________________________________
  339.  
  340. NJ_cursorOnOff  turn ON / OFF the blinking input cursor
  341.  
  342. Calling Syntax: NJ_cursorOnOff(int on)
  343. Input:          on = 1 -- turn ON the cursor
  344.                 on = 0 -- turn OFF the cursor
  345. Output:         (none)
  346. Return:         (none)
  347. See also:       NJ_getkey()
  348. Example:        
  349.         NJ_cursorOnOff(1);
  350.         NJ_gets(str, ...);
  351.         NJ_cursorOnOff(0);
  352.         ....
  353. __________________________________________________________________________
  354.  
  355. NJ_setcursor    set the blinking cursor position
  356.  
  357. Calling Syntax: NJ_setcursor(int row, int col) 
  358. Input:          row, col  -- the new cursor position in character
  359.                              coordinate (25x80)
  360. Output:         (none)
  361. Return:         (none)
  362. See also:       NJ_cursorOnOff()
  363. Example:        
  364.         NJ_setcursor(24, 1);
  365. __________________________________________________________________________
  366.  
  367. NJ_gets get a string including Chinese characters from screen
  368.  
  369. Calling Syntax: int NJ_gets(char *str, int row, int col, int len, int 
  370.                 Fcolor, int Bcolor)
  371. Input:          str -- the buffer for holding the input string, minimum
  372.                         length = len.
  373.                 len -- the maximum len of input string
  374.                 row, col -- the screen position where input string starts
  375.                 Fcolor -- foreground color (0 - 15)
  376.                 Bcolor -- background color (0 - 15)
  377. Output:         str -- the string entered by user
  378. Return:         -1  -- user cancel the input by ESC
  379.                 0   -- user end the input by ENTER
  380.                 >0 -- other non-editing keys
  381. See also:       NJ_puts()
  382. Example:        
  383.         char str[80];
  384.         NJ_gets(str, 10,5, 70, 15, 1);
  385.         ....
  386. __________________________________________________________________________
  387.         
  388. NJ_gets0        Same as NJ_gets, except that Chinese input is not allowed
  389.                 in this function
  390. __________________________________________________________________________
  391.  
  392. NJ_setinput     set Chinese input method
  393.          
  394. Calling Syntax: int NJ_setinput(int method, char select)
  395. Input:          method =0 -- ascii input
  396.                         1 -- PinYin input
  397.                         2 -- QuWeiMa input
  398.                         3 -- GuoBiao Input
  399.                         4 -- Other inputs
  400.                         5 -- ZhuYin input
  401.                 select -- for select a sub-method if the method has multiple
  402.                           choose such as 4 and 5. Not used for methods 0-3.
  403. Output:         (none)
  404. Return:         (none)
  405. See also:
  406. Example:        /* select WuBiZiXin method */
  407.                 NJ_setinput(4, 'B');
  408. ___________________________________________________________________________
  409.  
  410.  
  411. *       Screen Display
  412. __________________________________________________________________________
  413.  
  414. NJ_puts         Display a string of ascii, Chinese or mix of them on
  415.                 specific position of the screen with specific color.
  416. Calling Syntax: int NJ_puts(char str,int row,int col,int Fcolor,int Bcolor)
  417. Input:          str -- the string to display (ascii, Chinese or mix )
  418.                 row, col -- the screen position where the output starts
  419.                 Fcolor -- foreground color (0 - 15)
  420.                 Bcolor -- background color (0 - 15)
  421. Output:         (none)
  422. Return:         (none)
  423. See also:       NJ_gets()
  424. Example:        
  425.         /* display 'Chinese char' on 20,10 with Yellow on Red*/
  426.         NJ_puts("CHINESE Char", 20,10, 14,4);
  427.         .....
  428. __________________________________________________________________________
  429.  
  430. NJ_putc         Display a ascii character on specific position of the
  431.                 screen with color.
  432. Calling Syntax: int NJ_putc(char c,int row,int col,int Fcolor,int Bcolor)
  433. Input:          c -- the character to display (ascii 1-255)
  434.                 row, col -- the screen position where the output starts
  435.                 Fcolor -- foreground color (0 - 15)
  436.                 Bcolor -- background color (0 - 15)
  437. Output:         (none)
  438. Return:         (none)
  439. See also:       NJ_puts()
  440. Example:        
  441.         /* display 'A' on 20,10 with Yellow on Red*/
  442.         NJ_putc('A', 20,10, 14,4);
  443.         
  444. __________________________________________________________________________
  445.  
  446. NJ_window       Draw a outline window with specific color
  447.  
  448. Calling Syntax: int NJ_window(int r1, int c1, int h, int v, int color)
  449. Input:          r1, c1 -- upper left corner of the window (in pixels)
  450.                 h,  v  -- the Horizontal and vertical size of the
  451.                                 window (in pixels)
  452.                 color  -- the color of the screen
  453. Output:         (none)
  454. Return:         (none)
  455. See also:       NJ_fillwin()
  456. Example:        
  457.         NJ_window(50,100, 100, 400, 2);
  458.         ....
  459. __________________________________________________________________________
  460.  
  461. NJ_fillwin      Same as NJ_window, except not boarder outline
  462.  
  463. Calling Syntax: int NJ_fillwin(int r1, int c1, int h, int v, int color)
  464. Input:          r1, c1 -- upper left corner of the window (in pixels)
  465.                 h,  v  -- the Horizontal and vertical size of the
  466.                                 window (in pixels)
  467.                 color  -- the color of the screen
  468. Output:         (none)
  469. Return:         (none)
  470. See also:       NJ_window()
  471. Example:        
  472.         NJ_fillwin(50,100, 100, 400, 2);
  473.         ....
  474. __________________________________________________________________________
  475.  
  476. NJ_clscolum     Clear portion of the line with specified color
  477.  
  478. Calling Syntax: int NJ_clscolum(int row1, int col1, int col2, int color)
  479. Input:          row -- the line number
  480.                 col1 -- the start column number
  481.                 col2 -- the end column number
  482.                 color -- the color
  483. Output:         (none)
  484. Return:         (none)
  485. See also:       NJ_clsrows()
  486. Example:        
  487.         NJ_clscolum(1, 0,80, 15);
  488.         ....
  489. __________________________________________________________________________
  490.  
  491. NJ_clsrows      Clear number of lines
  492.  
  493. Calling Syntax: int NJ_clsrows(int row1, int row2, int color) 
  494. Input:          row1 -- the start line number
  495.                 row2 -- the end line number
  496.                 color -- the color
  497. Output:         (none)
  498. Return:         (none)
  499. See also:       NJ_clscolum()
  500. Example:        
  501.         NJ_clsrows(5,10, 15);
  502.         ....
  503. __________________________________________________________________________
  504.  
  505. NJ_line         Draw a horizontal or vertical line
  506.  
  507. Calling Syntax: int NJ_line(int row1, int col1, int row2, int col2, int color)
  508. Input:          row1 -- the start row in pixel
  509.                 col1  -- the start column in pixel
  510.                 row2 -- the end row in pixel
  511.                 col2  -- the end column in pixel
  512.                 color -- the line color
  513. Output:  (none)
  514. Return:  (none)
  515. See also:       NJ_box()
  516. Example:
  517.         NJ_line(5,0,5,640,15);
  518.         ....
  519. __________________________________________________________________________
  520.  
  521. NJ_box          Draw a rectangle box in given color
  522.  
  523. Calling Syntax: int NJ_line(int row1, int col1, int row2, int col2, int color)
  524. Input:          row1 -- the start row in pixel
  525.                 col1  -- the start column in pixel
  526.                 row2 -- the end row in pixel
  527.                 col2  -- the end column in pixel
  528.                 color -- the line color
  529. Output:  (none)
  530. Return:  (none)
  531. See also:       NJ_line()
  532. Example:
  533.         NJ_box(5,0,50,640,15);
  534.         ....
  535. __________________________________________________________________________
  536.  
  537. NJ_menu         Selecting a list of options by menu
  538.  
  539. Calling Syntax: int NJ_menu(int Fcolor1, int Bcolor1, int Fcolor2,int 
  540.                         Bcolor2,int pressed, struct MENU_S *sl,int ns,
  541.                         int ini,int(*msgfun)(char *))
  542.  
  543. Input:          Fcolor1, Bcolor1 -- the foreground and background color
  544.                                     of normal text
  545.                 Fcolor2, Bcolor2 -- the foreground and background color
  546.                                     of high lighted text (0 - 15).
  547.                 pressed=0 -- mouse cursor will move the selection item
  548.                              without press the mouse button
  549.                        =1 -- mouse cursor will move the selection item
  550.                              only if mouse button are pressed
  551.                 ns       -- number of selections in sl
  552.                 ini      -- the initial selection
  553.                 msgfun() -- the pointer to a user provided function for
  554.                             display the message
  555.                 sl       -- pointer to the structure of menu items.
  556.  
  557.                 struct MENU_S { /* as defined in NJSDK.H */
  558.                         char row;    /* display row */
  559.                         char col;    /* display col */
  560.                         char len;    /* display background len */
  561.                         char list;   /* the selection key in upper case */
  562.                         char *str;   /* menu string */
  563.                         char *msg;   /* message associated */
  564.                 } ;
  565.         
  566. Output:         (none)
  567. Return:         the number of selected item
  568. See also:       NJ_entry()
  569. Example:        
  570.         putmsg(char *str)
  571.         {
  572.                 NJ_puts(str, 20,20, 2,15);
  573.         }
  574.         struct MENU_S sl[2]={
  575.                 20,10, 10, 'Y', "Yes", "Confirm",
  576.                 21,10, 10, 'N', "No ", "quit"
  577.         }
  578.         main()
  579.         {
  580.             ....
  581.                 NJ_menu(11, 2, 14,4, 0, sl,2,0, putmsg);
  582.             ....
  583.         }
  584. __________________________________________________________________________
  585.  
  586. NJ_button       Select a list of options by pressing the button
  587.  
  588. Calling Syntax: int NJ_button(struct MENU_S *sl, int ns, int ini, int pressed)
  589.  
  590. Input:  pressed=0 -- mouse cursor will move the selection item without press
  591.                      the mouse button
  592.         pressed=1 -- mouse cursor will move the selection item only if mouse
  593.                      buttons are pressed
  594.         ns   -- number of selections in sl
  595.         ini  -- the initial selection
  596.         sl   -- pointer to the structure of menu items.
  597.  
  598.         struct MENU_S { /* as defined in NJSDK.H */
  599.                char row;     /* display row */
  600.                char col;     /* display col */
  601.                char len;     /* display background len */
  602.                char list;    /* the selection key in upper case */
  603.                char *str;    /* menu string */
  604.                char *msg;    /* message associated, not used by this function*/
  605.         } ;
  606.  
  607. Output:   (none)
  608. Return:   the number of selected item
  609. See also: NJ_menu()
  610. Example:
  611.         struct MENU_S sl[2]={
  612.                 {20,10, 10, 'Y', "Yes", " "},
  613.                 {21,10, 10, 'N', "No ", " "}
  614.         }
  615.         main()
  616.         {
  617.             ....
  618.                 NJ_button(sl,2,0,1);
  619.             ....
  620.         }
  621.  
  622. __________________________________________________________________________
  623.  
  624. NJ_entry        data entry routine
  625.  
  626. Calling Syntax: int NJ_entry(int Fcolor1, int Bcolor1, int Fcolor2,
  627.                         int Bcolor2, struct ENTRY_S *sl,int ns,int ini,
  628.                         int(*msgfun)(char *))
  629.  
  630. Input:          Fcolor1, Bcolor1 -- the foreground and background color
  631.                                     of normal text
  632.                 Fcolor2, Bcolor2 -- the foreground and background color
  633.                                     of high lighted text (0 - 15).
  634.                 ns       -- number of selections in sl
  635.                 ini      -- the initial selection
  636.                 msgfun() -- the pointer to a user provided function for
  637.                             display the message
  638.                 sl       -- pointer to the structure of menu items.
  639.  
  640.                 struct ENTRY_S {
  641.                     char row;           /* display row */
  642.                     char col;           /* display row */
  643.                     char len;           /* len of the  field */
  644.                     char type;          /* type of the field, not used*/
  645.                     char str[80];       /* str to hold field */
  646.                     char *msg;          /*message associated*/
  647.                 };
  648.  
  649.                 msgfun(char *msg) -- the pointer to a user provided
  650.                                      function for display the message.
  651.                       INPUT:  msg -- the string of message
  652.         
  653. Output:         sl -- the data entered are stored in sl[i].str.
  654. Return:         0 -- Normal return
  655.                 -1 - Data entry is cancelled by user
  656. See also:       NJ_menu
  657. Example:        
  658.         putmsg(char *str)
  659.         {
  660.                 NJ_puts(str, 20,20, 2,15);
  661.         }
  662.         struct ENTRY_S sl[2]={
  663.                 20,10, 10,0, " ", "Enter Your Name",
  664.                 21,10, 10,0, " ", "Enter you age"
  665.         }
  666.         main()
  667.         {
  668.             ....
  669.                 NJ_entry(11, 2, 14,4, sl,2,0, putmsg);
  670.             ....
  671.         }
  672. __________________________________________________________________________
  673.  
  674. NJ_dialog       data entry with push button and radio buttons
  675.  
  676. Calling Syntax: int NJ_dialog(int Fcol1,int Bcol1,int Fcol2,int Bcol2,
  677.                     int Fcol3, int Bcol3, struct DIALOG_S *sl,int ns,int ini,
  678.                     int(*DialogProc)(int, int), int(*msgfun)(char *));
  679.  
  680. Input:  Fcol1, Bcol1 -- the foreground and background color of normal text
  681.         Fcol2, Bcol2 -- the foreground and background color of data entry
  682.                         non-current item (0 - 15)
  683.         Fcol3, Bcol3 -- the foreground and background color of high lighted
  684.                         data entry item (0 - 15)
  685.  
  686.         ns   -- number of selections in sl
  687.         ini  -- the initial selection
  688.         sl   -- pointer to the structure of dialog items.
  689.  
  690.         struct DIALOG_S {
  691.             char row;           /* display row */
  692.             char col;           /* display row */
  693.             char len;           /* len of the  field */
  694.             char type;          /* type of the field:  0 - data entry */
  695.                                 /*                    -1 - push button */
  696.                                 /*                    -2 - radio button */
  697.             char radio;         /* store radio status*/
  698.             char str[80];       /* str to hold field value*/
  699.             char *msg;          /*message assorciated*/
  700.         };
  701.  
  702.         msgfun(char *msg) -- the pointer to a user provided function for
  703.                              display the message.
  704.               INPUT:  msg -- the string of message
  705.  
  706.         DialogProc(int k, int s) -- the pointer to a user provided function for
  707.                                     handling the dialog messages.
  708.                     INPUT:  k=-1 -- initialize dialog setting
  709.                             k=0  -- button number S has been pressed,
  710.                             k>0  -- a non-editing key has been pressed
  711.  
  712.                    Output:   -1 -- Cancel the dialog box
  713.                               0 -- End dialog and return to calling program
  714.                               1 -- Re-paint all entries
  715.  
  716.         NOTE: In DialogProc, user can access the information in DIALOG_S
  717.                      structure -- sl. See *****.C for example usage.
  718.  
  719. Output:  sl -- the data entered are stored in sl[i].str.
  720. Return:  0 -- Normal return, entry valid
  721.         -1 -- Data entry is cancelled by ESC or a push button.
  722. See also:     NJ_menu
  723. Example:
  724.         #include <stdio.h>
  725.         #include "njsdk.h'
  726.         #include "keys.h'
  727.  
  728.         struct ENTRY_S sl[4]={
  729.                 {10,10, 10,0,0 " ", "Enter Your Name"},
  730.                 {12,10, 10,0,0 " ", "Enter you age"},
  731.                 {15,10, 10,-1,0 "OK",     "Accept the input"},
  732.                 {15,13, 10,-1,0 "Cancel", "Quit the dialog"}
  733.         }
  734.  
  735.         int putmsg(char *str)
  736.         {
  737.                 NJ_puts(str, 20,20, 2,15);
  738.         }
  739.  
  740.  
  741.         int mydialogproc(int k, int s)
  742.         {
  743.                 if(k<0){
  744.                         if(s==2) return (0);      /* Ok     */
  745.                         else if(s==3) return(-1); /* cancel */
  746.                 }else if(k==PGUP){GetLastRecordFromDataBase();}
  747.                 }else if(k==PGDN){GetNextRecordFromDataBase();}
  748.                 return(1);
  749.         }
  750.  
  751.         main()
  752.         {
  753.             ....
  754.                 i=NJ_entry(15,1,11,2,14,4,sl,2,0,mydialogproc, putmsg);
  755.                 if(i<0)         /* Cancelled */
  756.                 else if(i>=0)   /* Ok       */
  757.             ....
  758.         }
  759. __________________________________________________________________________
  760.  
  761.  
  762. *       Printer Output  (Not included in trial version)
  763. __________________________________________________________________________
  764.  
  765. NJ_prt_init     Initialise printer driver
  766.  
  767. Calling Syntax: NJ_prt_init()
  768. Input:          (none)
  769. Return:         0  - Initialisation OK
  770.                 -1 - Initialisation failed
  771. See also:       NJ_init()
  772. Example:        
  773.         main(int argc, char **argv)
  774.         {
  775.                 NJ_init(argv[0]);
  776.                 ....
  777.                 NJ_prt_init()
  778.                 NJ_prts("CHINESE string");
  779.                 ....
  780.                 NJ_end();
  781.         }
  782. __________________________________________________________________________
  783.  
  784. NJ_prt_end     end of the printing
  785.  
  786. Calling Syntax: NJ_prt_end()
  787. Input:          (none)
  788. Return:         0  - Ok
  789.                 -1 - failed
  790. See also:       NJ_prt_init()
  791. Example:        
  792.         main(int argc, char **argv)
  793.         {
  794.                 NJ_init(argv[0]);
  795.                 ....
  796.                 NJ_prt_init()
  797.                 NJ_prts("CHINESE string");
  798.                 NJ_prt_end()
  799.                 ....
  800.                 NJ_end();
  801.         }
  802. __________________________________________________________________________
  803.  
  804. NJ_fontsize     Change the size of Chinese characters.
  805.  
  806. Calling Syntax: int NJ_fontsize(int size)
  807. Input:          size - size of printed Chinese chars (=1 or 2)
  808. Output:         (none)
  809. Return:         (none)
  810. See also:       NJ_prts()
  811. Example:        
  812.         NJ_fontsize(2);
  813.         .....
  814. __________________________________________________________________________
  815.  
  816. NJ_setmargin    Set Margins and line spacing
  817.  
  818. Calling Syntax: NJ_setmargin(int l, int r, int t, int b, int s)
  819. Input:          l = left margin in number of Chinese characters
  820.                 r = right margin in number of Chinese characters
  821.                 t = top margin in number of lines (1 line = 30 dots)
  822.                 b = bottom margin in number of lines (1 line = 30 dots)
  823.                 s = line spacing in number of pixels/dots
  824. Return:         0 - Ok;  -1 -Failed.
  825. See also:       NJ_linefeed()
  826. Example:        
  827.         NJ_setmargin(5,5,2,6,12);
  828.         ....
  829. __________________________________________________________________________
  830.  
  831. NJ_prts         Print a string to printer.
  832.  
  833. Calling Syntax: int NJ_puts(char str)
  834. Input:          str -- the string to display (ascii, Chinese or mix of them)
  835. Output:         (none)
  836. Return:         0  - OK
  837.                 -1 - Faild.
  838. See also:       NJ_puts()
  839. Example:        
  840.         NJ_prts("CHINESE Chars");
  841.         .....
  842. __________________________________________________________________________
  843.  
  844. NJ_linefeed     Feed the printer by number of pixels/dots
  845.  
  846. Calling Syntax: NJ_linefeed(int lines)
  847. Input:          lines -- the number of pixels/lines to feed
  848. Return:         (none)
  849. See also:       NJ_formfeed()
  850. Example:        
  851.         NJ_linefeed(5);
  852.         ....
  853. __________________________________________________________________________
  854.  
  855. NJ_formfeed     Feed the printer paper to next page
  856.  
  857. Calling Syntax: NJ_formfeed()
  858. Input:          (none)
  859. Return:         (none)
  860. See also:       NJ_linefeed()
  861. Example:        
  862.         NJ_formfeed(5);
  863.         ....
  864.  
  865. ============================================================================
  866. END of NJSDK.TXT
  867.